package com.simple.study.entity;

import lombok.Data;

/**
 * 返回结果实体类
 */
@Data
public class Result<T> {
    private Integer code;

    private String message = "操作成功";

    private Object data = null;

    public void setData(Object data) {
        if (null == data) {
            this.data = new Object();
        } else {
            this.data = data;
        }
    }

    public Result() {
    }

    public Result(Integer code) {
        this.code = code;
    }

    public Result(Integer code, Object data) {
        this.code = code;
        this.data = data;
    }

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
